-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add new time periods for ERC20 and native token permissions #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
packages/gator-permissions-snap/src/permissions/nativeTokenPeriodic/context.ts
Outdated
Show resolved
Hide resolved
…xt and time utility files
… token contexts; add tests for edge cases in getClosestTimePeriod function
…ve token contexts; add zPeriodDuration definition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
packages/gator-permissions-snap/src/permissions/erc20TokenPeriodic/context.ts
Outdated
Show resolved
Hide resolved
packages/gator-permissions-snap/src/permissions/erc20TokenPeriodic/context.ts
Outdated
Show resolved
Hide resolved
packages/gator-permissions-snap/src/permissions/erc20TokenPeriodic/rules.ts
Outdated
Show resolved
Hide resolved
packages/gator-permissions-snap/src/permissions/nativeTokenPeriodic/context.ts
Outdated
Show resolved
Hide resolved
… tests and labels for consistency
…emove getClosestTimePeriod function; simplify duration conversion logic
… ERC20 and native token contexts; update related tests for consistency
packages/gator-permissions-snap/src/permissions/erc20TokenPeriodic/rules.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
One minor comment - I don't feel strongly about it though. Maybe having the additional level of normalization as it is makes this more anti-fragile.
… across ERC20 and native token contexts; update related tests for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 🎉
Description
This PR updates the Transfer Window period picker to align with the latest design specifications.
Previously, the picker displayed durations in seconds or allowed manual input of seconds, which was confusing and inconsistent.
The updated picker now offers a fixed set of human-readable transfer window options for improved usability and clarity:
These predefined options provide a more opinionated and user-friendly experience, covering the majority of use cases while maintaining consistency with the design direction.
Related issues
Fixes: #396
Manual testing steps
Go to the page where the transfer period picker is displayed.
Open the period picker dropdown.
Verify that the options available are:
Select any option and confirm that:
Verify that manual second input is no longer available.
Screenshots/Recordings
Before
Period duration shown in seconds or manual seconds input field.
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Adds Hourly/Biweekly/Yearly options and replaces freeform seconds with a
Frequencydropdown; normalizesperiodDurationto a validated number across ERC20/native periodic permissions.periodType+ freeform seconds with a singleFrequencydropdown usingTimePeriodoptions (Hourly,Daily,Weekly,Biweekly,Monthly,Yearly).Duration (seconds)field; label updated to "Frequency".periodDurationnow anumber(not string); Zod useszPeriodDuration(<= 10 years) that snaps to closestTimePeriodseconds.periodTypefrom contexts/metadata; update validation to accept numericperiodDuration.TimePeriodenum andTIME_PERIOD_TO_SECONDSmapping; addgetClosestTimePeriod().applyContextandbuildContextupdated to use numericperiodDuration; stop deriving/storingperiodType.periodDuration.getClosestTimePeriod().Written by Cursor Bugbot for commit b9704d5. This will update automatically on new commits. Configure here.